/*
 *  bytecodes.cpp
 *  joosVM
 *
 *  Created by Smári Waage on 15.6.2009.
 *  Copyright 2009 smari.org. All rights reserved.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. *
 */

#include "bytecodes.h"



#define T(identifier, debug, bytecode, size, off_count, on_count, type, method) debug,
char* Bytecodes::_bytecode_strs[] = {
	BYTECODE_LIST(T)
};
#undef T

char* Bytecodes::LookupBytecode(byte code){
	return _bytecode_strs[code];
}

#if TRACE_JIT
MAKE_CALLINFO(Bytecodes::boxString,ARGSIZE_I,1,ABI_STDCALL);
 
MAKE_CALLINFO(Bytecodes::aaload_f,ARGSIZE_I,2,ABI_STDCALL);
MAKE_CALLINFO(Bytecodes::baload_f,ARGSIZE_I,2,ABI_STDCALL);
MAKE_CALLINFO(Bytecodes::aastore_f,ARGSIZE_NONE,3,ABI_STDCALL);

MAKE_CALLINFO(Bytecodes::getstatic_f,ARGSIZE_I,1,ABI_STDCALL);
MAKE_CALLINFO(Bytecodes::putstatic_f,ARGSIZE_NONE,2,ABI_STDCALL);
MAKE_CALLINFO(Bytecodes::arraylength_f,ARGSIZE_I,1,ABI_STDCALL);
#endif

/*
 static void nop(Stack* s){;}
 static void aconst_null(Stack* s); //Todo: change
 
 
 static void iconst_m1(Stack* s);
 static void iconst_0(Stack* s);
 static void iconst_1(Stack* s);
 static void iconst_2(Stack* s);
 static void iconst_3(Stack* s);
 static void iconst_4(Stack* s);
 static void iconst_5(Stack* s);
 
 static void lconst_0(Stack* s);
 static void lconst_1(Stack* s);
 
 static void fconst_0(Stack* s);
 static void fconst_1(Stack* s);
 static void fconst_2(Stack* s);
 static void dconst_0(Stack* s);
 static void dconst_1(Stack* s);
 //16
 static void bipush(Stack* s);
 //17
 static void sipush(Stack* s);
 
 //18 -ath med type
 static void ldc(Stack* s);
 static void ldc_w(Stack* s);
 static void ldc2_w(Stack* s);
 
 //26-29
 //21
 static void iload(Stack* s);
 static void iload_0(Stack* s);
 static void iload_1(Stack* s);
 static void iload_2(Stack* s);
 static void iload_3(Stack* s);
 
 static void fload(Stack* s);
 static void fload_0(Stack* s);
 static void fload_1(Stack* s);
 static void fload_2(Stack* s);
 static void fload_3(Stack* s);
 
 //42-45
 static void lload(Stack* s);
 static void lload_0(Stack* s);
 static void lload_1(Stack* s);
 static void lload_2(Stack* s);
 static void lload_3(Stack* s);
 
 static void dload(Stack* s);
 static void dload_0(Stack* s);
 static void dload_1(Stack* s);
 static void dload_2(Stack* s);
 static void dload_3(Stack* s);
 
 //25
 static void aload(Stack* s);
 static void aload_0(Stack* s);
 static void aload_1(Stack* s);
 static void aload_2(Stack* s);
 static void aload_3(Stack* s);
 
 static void iaload(Stack* s);
 //50
 static void aaload(Stack* s);
 //51
 static void baload(Stack* s);
 
 //59-62
 //54
 static void istore(Stack* s);
 
 static void istore_0(Stack* s);
 static void istore_1(Stack* s);
 static void istore_2(Stack* s);
 static void istore_3(Stack* s);
 
 static void fstore(Stack* s);
 static void fstore_0(Stack* s);
 static void fstore_1(Stack* s);
 static void fstore_2(Stack* s);
 static void fstore_3(Stack* s);
 
 static void lstore(Stack* s);
 static void lstore_0(Stack* s);
 static void lstore_1(Stack* s);
 static void lstore_2(Stack* s);
 static void lstore_3(Stack* s);
 
 static void dstore(Stack* s);
 static void dstore_0(Stack* s);
 static void dstore_1(Stack* s);
 static void dstore_2(Stack* s);
 static void dstore_3(Stack* s);
 
 //75-78
 static void astore_0(Stack* s);
 static void astore_1(Stack* s);
 static void astore_2(Stack* s);
 static void astore_3(Stack* s);
 
 static void astore(Stack* s);
 static void iastore(Stack* s);
 //83
 static void aastore(Stack* s);
 //84
 static void bastore(Stack* s);
 //87
 static void pop(Stack* s);
 static void pop2(Stack* s);
 
 //89		-needs some attention
 static void dup(Stack* s);
 //90
 static void dup_x1(Stack* s);
 //91
 static void dup_x2(Stack* s);
 //92
 static void dup2(Stack* s);
 //95
 static void swap(Stack* s);
 //96
 static void iadd(Stack* s);
 //100
 static void isub(Stack* s);
 //104
 static void imul(Stack* s);
 //108
 static void idiv(Stack* s);
 //112
 static void irem(Stack* s);
 //116
 static void ineg(Stack* s);
 //126
 static void iand(Stack* s);
 //128
 static void ior(Stack* s);
 //130
 static void ixor(Stack* s);
 
 //132
 static void iinc(Stack* s);
 //133
 static void i2l(Stack* s);
 //134
 static void i2f(Stack* s);
 //135
 static void i2d(Stack* s);
 //136
 static void l2i(Stack* s);
 //137
 static void l2f(Stack* s);
 //138
 static void l2d(Stack* s);
 //139
 static void f2i(Stack* s);
 //140
 static void f2l(Stack* s);
 //141
 static void f2d(Stack* s);
 //142
 static void d2i(Stack* s);
 //143
 static void d2l(Stack* s);
 //144
 static void d2f(Stack* s);
 //145
 static void i2b(Stack* s);
 //146
 static void i2c(Stack* s);
 //147
 static void i2s(Stack* s);
 //153
 static void ifeq(Stack* s);
 //154
 static void ifne(Stack*s);
 //155
 static void iflt(Stack* s);
 //156
 static void ifge(Stack* s);
 //157
 static void ifgt(Stack* s);
 //158
 static void ifle(Stack* s);
 //159
 static void  if_icmpeq(Stack* s);
 //160
 static void  if_icmpne(Stack* s);
 //161
 static void  if_icmplt(Stack* s);
 //162
 static void  if_icmpge(Stack* s);
 //163
 static void if_icmpgt(Stack* s);
 //164
 static void if_icmple(Stack* s);
 //165
 static void if_acmpeq(Stack* s);
 //166
 static void if_acmpne(Stack* s);
 //167
 static void _goto(Stack* s);
 //172
 static void ireturn(Stack* s);
 //176
 static void areturn(Stack* s);
 //177
 static void _return(Stack* s);
 //178
 static void getstatic(Stack* s);
 //179
 static void putstatic(Stack* s);
 //180
 static void getfield(Stack* s);
 //181
 static void putfield(Stack* s);
 //182
 static void invokevirtual(Stack* s);
 //183
 static void invokespecial(Stack* s);
 //184
 static void invokestatic(Stack* s);
 //187
 static void _new(Stack* s);
 //188
 static void newarray(Stack* s);
 //189
 static void anewarray(Stack* s);
 static void arraylength(Stack* s);
 //191
 static void athrow(Stack* s);
 static void checkcast(Stack* s);
 //193
 static void instanceof(Stack* s);
 //196
 static void wide(Stack* s);
 
 static void multianewarray(Stack* s);
 
 static void ifnull(Stack* s);
 
 static void ifnonnull(Stack* s);
 
 static void terminate(Stack* s);
 
 static void notImplemented(Stack* s);
*/
